<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.0/css/jquery.dataTables.css"></link>

<script type="text/javascript" language="javascript" src="//code.jquery.com/jquery-1.10.2.min.js"></script>
<script type="text/javascript" language="javascript" src="//cdn.datatables.net/1.10.0/js/jquery.dataTables.js"></script>

<script type="text/javascript" language="javascript">
jQuery.fn.dataTableExt.oApi.fnGetHiddenNodes = function ( settings )
{
    var nodes;
    var display = jQuery('tbody tr', settings.nTable);
 
    if ( jQuery.fn.dataTable.versionCheck ) {
        // DataTables 1.10
        var api = new jQuery.fn.dataTable.Api( settings );
        nodes = api.rows().nodes().toArray();
    }
    else {
        // 1.9-
        nodes = this.oApi._fnGetTrNodes( settings );
    }
 
    /* Remove nodes which are being displayed */
    for ( var i=0 ; i<display.length ; i++ ) {
        var iIndex = jQuery.inArray( display[i], nodes );
 
        if ( iIndex != -1 ) {
            nodes.splice( iIndex, 1 );
        }
    }
 
    return nodes;
};

$(document).ready(function() {
	   oTable = $('#product_table').dataTable();
	    
	   $('form').submit(function(){
	      $(oTable.fnGetHiddenNodes()).find('input:radio').appendTo(this);
	   });
	} );

	</script>
</head>
<body>
<h1>Pop Summary</h1>
<form id="form1" name="form1" method="post" action="" enctype="multipart/form-data">

<table width = "1200" border="1" cellspacing="1" cellpadding="5" id="product_table" >
<thead> 
  <tr>
		<th>Barcode</th>
		<th>Description</th>
		<th>Category</th>
		<th>Status</th>
		<th>POP</th>
	</tr>
 </thead> 	
 <tbody>
	<?php foreach($this->popList as $k => $v){?>
	<tr>
		<td><?php echo $v['code_product']?></td>
		<td><?php echo $v['title_product']?></td>
		<td><?php echo $v['cate']?></td>
		<td><?php if($v['status'] == 'popular'){?><img src = "/im/fire.jpg"></img><?php }?></td>
		<td>POP<input type = "radio" name = "popStatus[<?php echo $v['code_product']?>]" value = "pop"></input> Remove Pop<input type = "radio" name = "popStatus[<?php echo $v['code_product']?>]" value = "remove"></input></td>
		
	</tr>
	<?php }?>
 
  </tbody>
  
</table>

<br/>
<br/>
<input type = "submit" name = "submit" value = "submit"></input>

</form>
</body>
</html>